<?php

namespace app\controllers;

use app\logic\UserLogic;
use yii\web\HttpException;
use app\forms\user\LoginForm;
use app\components\Controller;

/**
 * 用户
 */
class UserController extends Controller
{
    protected function verbs()
    {
        return [
            'create' => ['POST'],
            'status' => ['POST'],
            'delete' => ['POST'],
        ];
    }

    /**
     * 创建 用户
     * @throws HttpException
     */
    public function actionCreate()
    {
        return UserLogic::create(getParams());
    }

    /**
     * 禁用、启用 用户
     * @throws HttpException
     */
    public function actionStatus()
    {
        return UserLogic::status(getParams());
    }

    /**
     * 删除 用户
     * @throws HttpException
     */
    public function actionDelete()
    {
        return UserLogic::delete(getParams());
    }


    /**
     * @return array[]
     * @throws HttpException
     */
    public function actionIndex()
    {
        //return IndexForm::index(getParams());
    }


    /**
     * @return array
     * @throws HttpException
     */
    public function actionLogin()
    {
        return LoginForm::login(getParams());
    }

    /**
     * 给用户赋予权限项
     * @throws HttpException
     */
    public function actionGrant()
    {
        //return GrantForm::grant(getParams());
    }

    /**
     * 用户拥有的权限项
     * @return mixed
     * @throws HttpException
     */
    public function actionGetItem()
    {
        //return ItemForm::getItem(getParams());
    }

    /**
     * 授权项下部门授权的数据
     * @return array
     * @throws HttpException
     */
    public function actionGetItemData()
    {
        //return ItemDataForm::getData(getParams());
    }

    /**
     * 用户所在岗位拥有的权限项
     * @return mixed
     * @throws HttpException
     */
    public function actionGetPositionItem()
    {
        //return PositionItemForm::getItem(getParams());
    }

    /**
     * 用户所在角色拥有的权限项
     * @return mixed
     * @throws HttpException
     */
    public function actionGetRoleItem()
    {
        //return RoleItemForm::getItem(getParams());
    }
}